###############################################################
#
# Purpose: Makefile for "M-JPEG Streamer"
# Author.: Tom Stoeveken (TST)
# Version: 0.3
# License: GPL
#
###############################################################

CC ?= gcc


OTHER_HEADERS = ../../capture.h 

CFLAGS +=  -Wall -O2 -DLINUX -D_GNU_SOURCE  -fPIC
CFLAGS_D = -Wall -g -DLINUX -D_GNU_SOURCE -fPIC
ifeq ($(CC),arm-linux-gcc)
LDFLAGS +=  -lpthread -fPIC
LDFLAGS_D =  -lpthread  -fPIC
else
LDFLAGS += -lpthread -fPIC
LDFLAGS_D = -lpthread -fPIC
endif


all: liboutput_file.so

liboutput_file.so: output_file.c $(OTHER_HEADERS) 
	$(CC) $(CFLAGS) $(LDFLAGS) $< -shared -o $@

debug:liboutput_file_d.so

liboutput_file_d.so : output_file.c $(OTHER_HEADERS) 
	$(CC) $(CFLAGS_D) $(LDFLAGS_D) $< -shared -o $@
clean:
	rm -f *.a *.o core *~ *.so *.lo


.PHONY: all clean debug
